﻿@using System.Globalization
@using System.Threading
@using EveKillboard.Core.Views
@model IEnumerable<EveKillboard.Core.Views.TopView>
           
<div id="topCorpsContent" style="border-left: 1px #323232 solid; border-right: 1px #323232 solid; border-bottom: 1px #323232 solid; padding-bottom: 5px;">
    <div class="topCorpsLabel gradientheader">
        @if (Model.First() is IMonthView){
            @string.Format(Thread.CurrentThread.CurrentCulture, EveKillboard.Content.Labels.month_top_corps, DateTime.Today.ToString("MMMM"))
        }else if (Model.First() is IWeekView){
            @string.Format(Thread.CurrentThread.CurrentCulture, EveKillboard.Content.Labels.week_top_corps,
                                 CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(
                                     DateTime.UtcNow.Date,
                                     CultureInfo.InvariantCulture.DateTimeFormat.CalendarWeekRule,
                                     CultureInfo.InvariantCulture.DateTimeFormat.FirstDayOfWeek)) 
        }
    </div>
    <div style="width: 140px; margin-left: auto; margin-right: auto">
        <img src="../../Content/themes/base/images/topkiller_64.png" width="64px" height="64px" style="border: 0px; margin-top: 6px; margin-bottom: 6px;" alt=""/>
        <img src="@string.Format("http://image.eveonline.com/Corporation/{0}_64.png", Model.First().EveId)" width="64px" height="64px" title="@string.Format("{0}", Model.First().Name)" style="border: 0px;margin-top: 6px; margin-bottom: 6px;" alt="">
    </div>
    @{
        var max = (decimal)(Model.First().Count);
    }
    @foreach (var corp in Model){
        <div style="padding-left: 3px; padding-right: 3px;">
            <div><a class="evelink" href="@string.Format("corporation/{0}", corp.InternalId)">@corp.Name</a></div>
            <div class="backgroundbar">
                <div class="innerbar" style="@string.Format(CultureInfo.InvariantCulture, "width:{0:n0}%;", (corp.Count / max) * 100)"></div>
            </div>
            <div style="text-align:right; display: inline-block; margin-left: 5px;">@string.Format(CultureInfo.InvariantCulture,"{0}",corp.Count)</div>
        </div>
    }
</div>